<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class Student {
            // 在实例化时就会自动执行，不用手动调用
            // 构造函数、构造方法、构造器--在new一个实例的时候，参数会被constructor接收
            constructor(n, a) {
                console.log(n, a);
                this.name = n;
                this.age = a;
            }
            // 类的方法
            say() {
                let str = `我是${this.name}，今年${this.age}了`
                return str
            }
            show = ()=>{
                let arr1 = [1,2,3,4,5];
                let arr2 = [...arr1]
                console.log(arr2);
            }
        }

        let zzg = new Student('zzg', 18);
        console.log(zzg.say());
        zzg.show();
    </script>
</body>
</html>